<!DOCTYPE html>
<html>
<head>
	<title></title>
	<base href="http://localhost/">
	<link rel="stylesheet" type="text/css" href="layui/css/layui.css">
	<script type="text/javascript" src="layui/layui.js"></script>
</head>
<body style="padding: 10px">
	<form method="post" action="<?=site_url('/Admbooks/book_save')?>" name="userform">
		<div class="layui-form">
			<div class="layui-form-item">
				<label class="layui-form-label">图书编号</label>
				<!-- 创建一个隐藏的input 存放id -->
				<input type="hidden"  value="<?= $data['Book_ID']?>" name="editBook_ID">
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="editISBN" value="<?= $data['ISBN']?>">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">图书类别</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="editType" value="<?= $data['Type']?>">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">图书名称</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="editTitle" value="<?= $data['Title']?>">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">图书作者</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="editAuthor" value="<?= $data['Author']?>">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">出版社</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="editPublisher" value="<?= $data['Publisher']?>">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">图书总数</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="editNumber" value="<?= $data['Number']?>">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">图书库存</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="editStocks" value="<?= $data['Stocks']?>">
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" onclick="return check(userform)">保存</button>
					<!-- <button class="layui-btn" onclick="cheremove()">取消</button> -->
				</div>
			</div>

		</div>
	</form>

	<script type="text/javascript">
		layui.use(['layer','form'],function(){
			form = layui.form;
			layer = layui.layer;
			$ = layui.jquery;
		});
		// function cheremove(){
		// 	var mylay = parent.layer.getFrameIndex(window.name);
		// 	parent.layer.close(mylay);
		// };
		function check(form){
			if(form.editISBN.value == ""){
				alert("图书编号不能为空");
				form.editISBN.focus();
				return false;
			}
			if(form.editTitle.value == ""){
				alert("图书名称不能为空");
				form.editTitle.focus();
				return false;
			}
			if(form.editAuthor.value == ""){
				alert("图书作者不能为空");
				form.editAuthor.focus();
				return false;
			}
			form.submit;
			//提交完成关闭模态框
			var mylay = parent.layer.getFrameIndex(window.name);
			parent.layer.close(mylay);
		}

	</script>
</body>
</html>